package com.linux.huhx.thread3.reentrantLock_1;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Author: huhx
 * @Date: 2017-10-30 下午 2:56
 */
public class MyService {
    private Lock lock = new ReentrantLock();

    public void testMethod() {
        lock.lock();
        for (int i = 0; i < 5; i++) {
            System.out.println("name=" + Thread.currentThread().getName() + ", i=" + i);
        }
        lock.unlock();
    }
}
